- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.3k
gh-131311: Fix memory leak in PyCStructUnionType_update_stginfo #131312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-131311: Fix memory leak in PyCStructUnionType_update_stginfo #131312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to locate the error label I needed to expand the entire file. This shows that this function should be probably splitted into multiple steps if possible, or that the if () at the end should be separate.
WDYT @encukou? any reason to keep a single large function?
| @picnixz Thanks for explanation. I will try to explain further issues better. About this function - I fully agree that it has large complexity, and it is better to split it. | 
| Thank you for the fix! Since the function has the  (If you want to go further, you can do the same for  
 Yes (though I don't think it's a priority). | 
| OK, will move cleanup to error section. Would you like to me to open a new PR to split this function and maybe another one for StgInfo.format? | 
| I moved cleanup of locals to the error section except of  cpython/Modules/_ctypes/stgdict.c Line 444 in a09c2b2 
 type_blockthere. Should I do it in this PR or add new one? | 
| Thank you for the fix! | 
…_update_stginfo to fix memory leak (pythonGH-131312)
…_update_stginfo to fix memory leak (pythonGH-131312)
Fix memory leak in PyCStructUnionType_update_stginfo on fail path.